headerbar: don't allocate both label and custom title
authorRay Strode <rstrode@redhat.com>
Thu, 23 Jun 2016 12:57:55 +0000 (08:57 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 23 Jun 2016 18:32:33 +0000 (14:32 -0400)
It's only possible to have a label or a custom title, not both.
The size allocate code confusingly treats them as independent.

That is confusing, because, as the code is written, it makes it
look like the space for the custom title isn't getting accounted
for.

This commit else-ifies some parts of the size allocate code for
clarity.

gtk/gtkheaderbar.c

index 5c5b13a3e2ccebe195abcab5edb704067f154671..b133587b476ef5493ae1c2475c11268167a3fb99 100644 (file)
@@ -1042,8 +1042,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
                                                  &title_minimum_size,
                                                  &title_natural_size);
     }
-
-  if (priv->label_box != NULL)
+  else if (priv->label_box != NULL)
     {
       gtk_widget_get_preferred_width_for_height (priv->label_box,
                                                  height,
@@ -1157,8 +1156,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget        *gadget,
   if (priv->custom_title != NULL &&
       gtk_widget_get_visible (priv->custom_title))
     gtk_widget_size_allocate (priv->custom_title, &child_allocation);
-
-  if (priv->label_box != NULL)
+  else if (priv->label_box != NULL)
     gtk_widget_size_allocate (priv->label_box, &child_allocation);
 
   child_allocation.y = allocation->y;